A messaging service is an application program interface (API) that supports the formal communication known as messaging between computers in a network. Here, messaging is the creation, storage, exchange, and management of messages between producers who send/publish the messages to a queue of a destination and consumers who receive, subscribe, and browse the messages from the queue of the destination. Here, a message can be but are not limited to, text, image, voice, telex, fax, e-mail, paging, and other suitable electronic data describing events, requests, and replies over a communications network. The destination can be hosted on a messaging server.
Before arriving at its destination, a message can be at the status of “in-flight work” with respect producers and consumers. In-flight work messages associated with producers may include:
Un-born Messages
Messages that are produced by the producer with “birth time” (time to deliver) set in future are called un-born messages and are treated and counted as “pending” messages for the statistics purposes. Also, these “pending” messages are not available for the consumption from the destination by consumers yet.
Un-committed Messages
These are the messages that are produced by the producer as part of a transaction (using either user transaction or transacted session) and the transaction is still not committed or rolled back. These messages are also treated and counted as “pending” messages for the statistics purposes. Also these pending messages are not available for consumption from the destination by the consumers yet.
Quota Blocking Send
These are the messages that are produced by the producers but are not able reach the destination because of (either message or byte or both) quota limit on the destination and the producers are willing to block for a specific period of time for the quota to be available. These messages are invisible to the system and are not counted against any of the destination statistics.
In-flight work messages associated with consumers may include:
Un-acknowledged (Client Acknowledge Pending) Messages
These are the messages that have been successfully consumed by the clients, and are awaiting acknowledgements from the clients. These are “pending messages” which will be removed from the destination/system when the acknowledgement is received.
Un-committed Messages
These are the Messages that are consumed (received) by the clients within a transaction and the transaction is still not committed or rolled back. They willbe removed from the system when the clients successfully commit the transaction.
Rolled Back Messages
These are the messages that are put back on the destination because of a successful rollback of transactional receive by the consumers. These messages might or might not be ready for consumption (re-delivered) to the clients immediately, depending on the redelivery parameters. If there is a redelivery delay configured, then the messages are not available for consumption for that “delay” duration and are counted as “pending” in the destination statistics; if the redelivery limit is not exceeded after the “delay” period, they are delivered (made available for consumption) on that destination and are counted as “current” messages in the destination statistics; if the redelivery limit exceeds, then those messages will be moved to “error destination” if one configured or will be deleted (dropped) from the system.
Recovered Messages
These messages are similar to “ROLLED BACK MESSAGES” discussed above. Except that these messages appear on the queue because of an explicit call to session “recover” by the client.
Redelivered Messages
These are again similar to “ROLLED BACK MESSAGES” except that these messages may re-appear on the destination because of an un-successful delivery attempt to the client (consumer crash, close etc.).
Message arriving at a destination can be caused by either new producing operation from the producers or the completion of in-flight work messages. It is sometimes desirable to drain the queue at the destination empty before allowing any further messages to arrive, which requires the complete pause of the entire message production on the destination.